package hu;

import java.util.*;

public class hu89 {
    static List<String> path = new ArrayList<>();
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] str = sc.nextLine().split(" ");
        int[] used = new int[str.length];
        for (int i = 0; i < str.length; i++) {
            if(str[i].equals("joker") || str[i].equals("JOKER")){
                System.out.println("ERROR");
                return;
            }
            if(str[i].equals("A"))
                str[i] = "1";
            if(str[i].equals("J"))
                str[i] = "11";
            if(str[i].equals("Q"))
                str[i] = "12";
            if(str[i].equals("K"))
                str[i] = "13";
        }
        for (int i = 0; i < str.length; i++) {
            path.clear();
            path.add(str[i]);
            used[i] = 1;
            if(trackBack(used, str, Integer.parseInt(str[i])) && path.size() == 7) {
                for (String s : path) {
                    if(s.equals("1"))
                        s = "A";
                    if(s.equals("11"))
                        s = "J";
                    if(s.equals("12"))
                        s = "Q";
                    if(s.equals("13"))
                        s = "K";
                    System.out.print(s);
                }
                return;
            }
            used[i] = 0;
        }
        System.out.println("NONE");

    }
    public static boolean trackBack(int[] used, String[] str, int ans) {
        if (path.size() == 7 && ans == 24) {
            return true;
        }
        for (int i = 0; i < str.length; i++) {
            if (used[i] == 0) {
                used[i] = 1;
                path.add("+");
                path.add(str[i]);
                if(trackBack(used, str, ans + Integer.parseInt(str[i])))
                    return true;
                path.remove(path.size() - 1);
                path.remove(path.size() - 1);
                used[i] = 0;

                used[i] = 1;
                path.add("-");
                path.add(str[i]);
                if(trackBack(used, str, ans - Integer.parseInt(str[i])))
                    return true;
                path.remove(path.size() - 1);
                path.remove(path.size() - 1);
                used[i] = 0;

                used[i] = 1;
                path.add("*");
                path.add(str[i]);
                if(trackBack(used, str, ans * Integer.parseInt(str[i])))
                    return true;
                path.remove(path.size() - 1);
                path.remove(path.size() - 1);
                used[i] = 0;

                used[i] = 1;
                path.add("/");
                path.add(str[i]);
                if(trackBack(used, str, ans / Integer.parseInt(str[i])))
                    return true;
                path.remove(path.size() - 1);
                path.remove(path.size() - 1);
                used[i] = 0;
            }
        }
        return false;
    }
}
